export default {
  data() {
    return {
      tableHeight: 0
    }
  },
  mounted () {
    this.initListener()
  },
  beforeDestroy () {
    this.destroyListener()
  },
  methods: {
    initListener () {
      window.addEventListener('resize', this.setTableHeight)
    },
    destroyListener () {
      window.removeEventListener('resize', this.setTableHeight)
    },
    /**
     * @msg: 设置表格高度
     * @param {type}
     * @return:
     */
    setTableHeight () {
      this.tableHeight = this.$refs.table && this.$refs.table.$el && this.$refs.table.$el.clientHeight
    }
  }
}
